package org.dbp.core.service.service.impl;

import java.io.Serializable;
import java.util.List;

import org.dbp.core.service.dao.GenericDao;
import org.dbp.core.service.service.GenericService;
import org.springframework.transaction.annotation.Transactional;

public class GenericServiceImpl<C extends Serializable, ID extends Serializable, FL extends Serializable>
		implements GenericService<C, ID, FL> {

	GenericDao<C, ID, FL> dao;

	public GenericServiceImpl(GenericDao<C, ID, FL> dao) {
		super();
		this.dao = dao;
	}

	@Transactional
	public ID insert(C obj) {
		return dao.insert(obj);
	}

	@Transactional
	public C findId(ID id) {
		return dao.findId(id);
	}

	@Transactional
	public List<C> findAll() {
		return dao.findAll();
	}

	@Transactional
	public C update(C obj) {
		return dao.update(obj);
	}

	@Transactional
	public C uptateNotNull(C obj) {
		return dao.uptateNotNull(obj);
	}

	@Transactional
	public void remove(ID id) {
		dao.remove(id);
	}

	@Transactional
	public List<C> findFilter(FL filtro) throws Exception {
		return dao.findFilter(filtro);
	}
}
